home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11213 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  44 lines

  1. Path: unsw.edu.au!usenet
  2. From: s2139589@cse.unsw.edu.au (CC)
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: HELP!: Error when trying to use cout in MSVC++ 4.0!
  5. Date: Wed, 13 Mar 1996 05:51:30 GMT
  6. Organization: University of New South Wales
  7. Message-ID: <4i5kpd$eic@mirv.unsw.edu.au>
  8. NNTP-Posting-Host: modem.circus.cse.unsw.edu.au
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. Hi,
  12.  
  13. I am having trouble compiling a very simple program consisting of one
  14. line of code in main(). I am using Microsoft Visual C++ Version 4.0 on
  15. WIN95.  Basically I am trying to use cout to print a word, however the
  16. compiler keeps generating the following error:
  17.  
  18. E:\Labs\lab1.c(4) : error C2065: 'cout' : undeclared identifier
  19. E:\Labs\lab1.c(4) : error C2297: '<<' : bad right operand
  20. Error executing cl.exe.
  21. lab1.obj - 2 error(s), 0 warning(s)
  22.  
  23. Here is my code:
  24. #include <iostream.h>
  25.  
  26. void main()
  27. {    cout << "Hi";
  28. }
  29.  
  30. I have checked that iostream.h is in the standard include directory
  31. and I am quite sure that the compiler has found it because I once
  32. entered iostreams.h instead of iostream.h and it generated an error
  33. saying it could not find the file. After entering the correct
  34. name(iostream.h) that error has disappeared, but I get the above
  35. errors. Everything is fine if I use printf.
  36. Can someone please tell what is going on and how to fix it? 
  37. Could it be that cout, cin is not supported in MSVC4.0?
  38.  
  39. Thanks a lot!
  40.  
  41. CC
  42. PS. reply by email if possible at s2139589@cse.unsw.edu.au
  43.  
  44.